package xyz.lwm.lazycat.transaction;

import xyz.lwm.lazycat.transaction.execute.Isolation;
import xyz.lwm.lazycat.transaction.execute.Propagation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 事务注解 (AOP原理)
 *
 * @author lwm
 */
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Transactional {

    /**
     * 事务传播行为
     */
    Propagation propagation() default Propagation.REQUIRED;

    /**
     * 事务隔离级别
     */
    Isolation isolation() default Isolation.DEFAULT;

    /**
     * 是否只读事务
     */
    boolean readOnly() default false;

    /**
     * 哪些异常回滚
     */
    Class<? extends Throwable>[] rollbackFor() default {};

}